//
// Created by xili on 2024/8/14 9:55.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    string reversePrefix(string word, char ch) {
        int n = word.size();
        for (int i = 0; i < n; i++) {
            if (word[i] == ch) {
                reverse(word.begin(), word.begin() + i);
                return word;
            }
        }
        return word;
    }
};